<% String title="DAS registry scripting";
   String header = title;
%>


<%@ include file="sangerheader.jsp" %>
<div id="main">

<h2>DAS registry help - scripting</h2>


<p> The DAS registration server provides two mechanisms to access its content programmatically:</p>
    
<ul>
	<li>(1)a simple http - XML web services</li>
	<li>(2)a SOAP - web services</li>
</ul>

<p> You can choose one of these methods. (the simple http-XML web service is quicker, so we would 
recommend that one).
</p>


<h2>(1) Simple http - XML web service (DAS style)</h2>

There are several URL commands available that allow to access the registry data via XML:
<ul>
<li><a href="#sources">sources</a></li>
<li><a href="#organism">organism</a></li>
<li><a href="#coordinatesystem">coordinatesystem</a></li>
<li><a href="#lastModified">lastModified</a></li>
</ul>


<a name="sources"/><h3>sources</h3></a>
<p>
This is a simple request that lists all DAS sources. 
It is a back-port from the corresponding <a href="http://biodas.org/documents/das2/das2_get.html#sources">DAS/2 command</a>.
To get the listing of all available DAS sources follow this link: <br/>
<a href="http://www.dasregistry.org/das/sources/">http://www.dasregistry.org/das/sources/</a> or 
<a href="http://www.dasregistry.org/das1/sources/">http://www.dasregistry.org/das1/sources/</a> 
or for 1.5 sources only <a href="http://www.dasregistry.org/das1.5/sources/">http://www.dasregistry.org/das1.5/sources/</a>
or for 1.6 sources only <a href="http://www.dasregistry.org/das1.6/sources/">http://www.dasregistry.org/das1.6/sources/</a>
<br/>
<br/>
To view the response in your browser click here: <a href="view-source:http://www.dasregistry.org/das1/sources/">view-source:http://www.dasregistry.org/das1/sources/</a>

It is simple to open a http connection to this url and parse the returned XML file in most programming languages.

A Java library that provides access using this is e.g. <a href="http://www.spice-3d.org/dasobert/">Dasobert</a>

<br/>
<br/>
The <strong>sources</strong> command so far accepts several (optional) arguments. It is also possible to combine these.
</p>
<ul>
<li><b>label</b> -  This allows to get a listing of all DAS sources with the requested label. e.g <a href="/dasregistry/das1/sources?label=BioSapiens">http://www.dasregistry.org/das1/sources?label=BioSapiens</a> </li>
<li><b>organism</b> - This allows to get a listing of all DAS sources for an organism (or it's NCBI taxonomy id). 
e.g. <a href="/dasregistry/das1/sources?organism=Homo%20Sapiens">http://www.dasregistry.org/das1/sources?organism=Homo%20Sapiens</a><br/>
<a href="/dasregistry/das1/sources?organism=9606">http://www.dasregistry.org/das1/sources?organism=9606</a></li>
<li><b>authority</b> - Filter by the authority of coordinate systems
e.g. <a href="/dasregistry/das1/sources?authority=UniProt">http://www.dasregistry.org/das1/sources?authority=UniProt</a>
</li>
<li><b>capability</b> - Only show servers that support particular DAS commands
e.g. <a href="/dasregistry/das1/sources?capability=sequence">http://www.dasregistry.org/das1/sources?capability=sequence</a>
</li>
<li><b>type</b> - Display servers with particular types of coordinate systems
e.g. <a href="/dasregistry/das1/sources?type=Chromosome">http://www.dasregistry.org/das1/sources?type=Chromosome</a>
</li>
<li><b>version</b> - Display servers with particular version of coordinate systems
e.g. <a href="/dasregistry/das1/sources?version=36">http://www.dasregistry.org/das1/sources?type=Chromosome</a>
</li>
<li><b>Combining</b> - Display servers with particular coordinate systems by combining these paramters
e.g. <a href="/dasregistry/das1/sources?organism=9606&authority=NCBI&version=36&type=chromosome">http://www.dasregistry.org/das1/sources?organism=9606&authority=NCBI&version=36&type=chromosome</a>
</li>

</ul>
<p>
It is possible to access information for a single DAS source, if its unique ID is known.
e.g.  <a href="/dasregistry/das1/sources/DS_410">http://www.dasregistry.org/das1/sources/DS_410</a>

</p>
<br/>
<br/>

<a name="organism"></a><h3>organism</h3>
<p>
The URL <a href="http://www.dasregistry.org/das1/organism">http://www.dasregistry.org/das1/organism</a>

provides you with a list of the organisms as they are currently known by the registration server.

</p>


<br/>
<br/>

<a name="coordinatesystem"></a><h3>coordinatesystem</h3>

<p>The URL <a
	href="http://www.dasregistry.org/das1/coordinatesystem">http://www.dasregistry.org/das1/coordinatesystem</a>
gives a list of all <a href="help_coordsys.jsp">coordinate systems</a>
as they are know to the registry. Each coordinate system has a unique
URI. This can be resolved to a short description of it, e.g. <a
	href="http://www.dasregistry.org/coordsys/CS_DS6">the description
page of the UniProt,Protein sequence</a> coordinate system. See <a
	href="help_coordsys.jsp">the help page for coordinate systems</a> for
more information.</p>

<br/>
<br/>

<a name="lastModified"></a><h3>lastModified</h3>
<p>
The URL <a href="http://www.dasregistry.org/das1/lastModified">http://www.dasregistry.org/das1/lastModified</a>
provides the time stamp when the DAS registry has been creating/modifing/deleting a DAS source the last time.
</p>
<p>
The same is available via the getLastModified HTTP header from the URL http://www.dasregistry.org/das1/ .
The result is the number of milliseconds (a <i>long</i> integer) since January 1, 1970 GMT.
e.g. try a:
</p>
<pre>
curl -I http://www.dasregistry.org/das1/lastModified
</pre>

<br/>
<br/>

<a name="Validate"></a><h3>Validate</h3>
<p>
The registry runs an autovalidate on all registered servers about every 3 hours - however you can request that the registry validate a DAS source if it is publically accessible using this url.
The URL <a href="http://www.dasregistry.org/validate/">http://www.dasregistry.org/validate/</a> with a minimum set of parameters url and testcode for example <a href="http://www.dasregistry.org/validate/?url=http://das.sanger.ac.uk/das/otter_das/&testcode=22:19173435,19372173
">http://www.dasregistry.org/validate/?url=http://das.sanger.ac.uk/das/otter_das/&testcode=22:19173435,19372173</a>
provides a sources response which lists the possible capabilities and whether they are invalid or valid.
</p>
<p>
Other parameters available are:

<br/>
<br/>


<h2>(2) SOAP web service</h2>
<p>The <a href="services/das:das_directory?wsdl">wsdl</a> that describes this SOAP web service is available from <a href="services/das:das_directory?wsdl"> here </a>. 


<p> For <strong>Java</strong> clients there is a library available that can be
used for communication. The class DasRegistryAxisClient does all the
SOAP communication. So a typical call to the Registry looks like:

<pre>	
import org.biojava.services.das.registry.*;
...
URL url = new URL("http://www.dasregistry.org" +
	  "/services/das_registry/");
<a href="http://www.derkholm.net/svn/repos/dasregistry/trunk/src/org/biojava/services/das/registry/DasRegistry.java">DasRegistry</a> client = new <a href="http://www.derkholm.net/svn/repos/dasregistry/trunk/src/org/biojava/services/das/registry/DasRegistryAxisClient.java">DasRegistryAxisClient</a>(url);
<a href="http://www.derkholm.net/svn/repos/dasregistry/trunk/src/org/biojava/services/das/registry/DasSource.java">DasSource</a>[] services = client.listServices();	
</pre>





<p/>
<%@ include file="sangertablestart.jsp" %>
<table width="550" border="0">
<tr><td>
Example script how to contact the registry using <strong>Perl</strong>:
<pre>
#!/usr/bin/perl -Tw

use strict;
use warnings;

use SOAP::Lite;

print "Connecting to DAS registry\n";

my $sources =
  SOAP::Lite->service(
        'http://www.dasregistry.org/services/das'
      . ':das_directory?wsdl' )->listServices();

foreach my $source ( @{$sources} ) {

    while ( my ( $key, $value ) = each( %{$source} ) ) {

        if ( ref $value eq 'ARRAY' ) {
            if ( $key eq 'coordinateSystem' ) {

                foreach my $coords ( @{$value} ) {
                    print "coordinate system:\n";
                    while ( my ( $dcskey, $dcsvalue ) =
                        each( %{$coords} ) )
                    {
                        printf "\t%-16s => %s\n", $dcskey, $dcsvalue;
                    }
                }

            } else {
                printf "%-16s => %s\n", $key, join( ', ', @{$value} );
            }

        } else {
            $value =~ s/\s+/ /gs;
            printf "%-16s => %s\n", $key, $value;
        }
    }
}
</pre>
</td></tr>
</table>
<%@ include file="sangertableend.jsp" %>


</div>

<%@ include file="sangerfooter.jsp" %>



